/*
 * @Title: 
 * @Created by: ycq
 */
<template>
	<view class="">
		<IndexHead :config='pageConfig'></IndexHead>
		<view :style="{height:statusBarHeight}" class="uni-status-bar"></view>
		<view  class="order-list"   >
			<view class="order-item" :class="tipIndex == 0 ? 'order-item-active':''">
				<text @click="chooseTip(0)">热门推荐</text>
				<view class="order-line"  :class="tipIndex == 0? 'active':''"></view>
			</view>
			<view class="order-item" :class="tipIndex == 1 ? 'order-item-active':''">
				<text @click="chooseTip(1)">全部状态</text>
				<view class="order-line"  :class="tipIndex == 1? 'active':''"></view>
			</view>
			<view class="order-item" :class="tipIndex == 2 ? 'order-item-active':''">
				<text @click="chooseTip(2)">个体自营</text>
				<view class="order-line"  :class="tipIndex == 2 ? 'active':''"></view>
			</view>
			<view class="order-item" :class="tipIndex == 3 ? 'order-item-active':''">
				<text @click="chooseTip(3)">景区自营</text>
				<view class="order-line"  :class="tipIndex == 3 ? 'active':''"></view>
			</view>
		</view>
		<view class="like">
			<view class="goods-item" v-for='(item,index) in likeData' :key='index'   @touchmove="gtouchmove()" @touchstart='tcStart(index)' @touchend.prevent="touchend">
				
				<view class="item-btns" v-if="openIndex == index"  >
					<view class="item-btn">
						<image src="/static/nolike.png"></image>
						<text>不感兴趣</text>
					</view>
					<view class="item-btn">
						<image src="/static/pingbi.png"></image>
						<text>屏蔽:扇子</text>
					</view>
					<view class="item-btn">
						<image src="/static/bushi.png"></image>
						<text>图片引起不适</text>
					</view>
					<view class="item-btn">
						<text>找同款</text>
					</view>
				</view>
				<view><image class="item-img" :src="item.img"></image>
				<text class="title">
					{{item.title}}
				</text>
				<text class="prize" >￥{{item.prize}}<text class="p-dot">{{item.prizeD}}</text></text>
				<text class="buyNum" >{{item.buyNum}}人付款</text></view>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				pageConfig:{
					common:{
						hasSearch:false, //显示整版搜索框
						hasTitle:false, //显示页面title
						hasMenu:false,
						minHead:true
					},
					left:{
						showPos:false,
					},
					mid:{
						title:'' ,//页面title
						hasSearchMid2:true //显示中间搜索框
					},
					right:{
						
					}
				},
				tipIndex:0,
				typeIndex:0,
				isMoving:false,
				statusBarHeight:global.statusBarHeight + 'px',
				isMask:false,
				openIndex:null,
				likeData:[
					{
						title:'宫廷古风中国风口红 长相思持久保湿防水',
						img:'/static/banner.png',
						prize:'69.',
						prizeD:'5',
						buyNum:123123
					},
					{
						title:'国粹京剧脸谱戏曲Q版人物吊坠书签金属创意古风',
						img:'/static/banner.png',
						prize:'69.',
						prizeD:'5',
						buyNum:1223
					},
					{
						title:'中国特色礼物送老外北京特色工艺品京剧脸谱摆件商务外事出国礼品',
						img:'/static/banner.png',
						prize:'69.',
						prizeD:'5',
						buyNum:1564
					},
					{
						title:'砚台天然原石 复刻故宫博物院款式 松花砚',
						img:'/static/banner.png',
						prize:'69.',
						prizeD:'5',
						buyNum:2333
					}
				],
			}
		},
		methods: {
			openMask(index){
				if(this.openIndex != index){
					this.openIndex = index
				}else{
					this.openIndex = null
				}
			},
			chooseTip(index){
				this.tipIndex = index
				if(this.showType){
					this.showType = !this.showType
				}
			},
			toDetail(){
				uni.navigateTo({
					url:'shopDetail'
				})
			},
			tcStart(index){
				clearTimeout(this.Loop); //再次清空定时器，防止重复注册定时器
				if(this.openIndex != index){
					this.Loop = setTimeout(function() {
						this.openMask(index)
						this.isMask = true
					}.bind(this), 500);
				}else{
					this.openMask(index)
				}
			},
			touchend() {
				clearTimeout(this.Loop);
				if (this.Loop != 0 && this.isMask == false && !this.isMoving) {
					this.toDetail()
				 }
				  
				this.isMoving = false
				this.isMask = false
			},
			gtouchmove(){
				this.isMoving = true
			    clearTimeout(this.Loop);//清除定时器;
			},
		},
		created(){
			
		}
	}
</script>

<style scoped>
	.uni-status-bar {
		display: block;
		width: 100%;
		height: var(--status-bar-height);
		/* border:1upx solid blue */
	}
	.order-list{
		width: 100%;
		margin-top: -40upx;
		position: absolute;
		display: flex;
		flex-direction: row;
	}
	.order-item{
		width: 25%;
		height: 45upx;
		text-align: center;
		
	}
	.order-item text{
		width: 100%;
		display: block;
		color: #0075EE;
		line-height: 30upx;
		font-size: 26upx;
		text-align: center;
	}
	.order-item-active text{
		font-size: 28upx;
		line-height: 30upx;
		font-weight: bold;
	}
	.order-item .level{
		text-align: right;
		padding-right: 6upx;
	}
	.order-item .level-t{
		text-align: center;
	}
	.sanjiao{
		width: 0upx;
		height: 0upx;
		/* background: #55A0FF; */
		float: right;
		margin-right: 0;
		border: 10upx solid transparent;
		border-top-color: #55A0FF;
		margin-top: 10upx;
		margin-left: 5%;
	}
	.sanjiao-d{
		width: 0upx;
		height: 0upx;
		/* background: #55A0FF; */
		float: right;
		margin-right: 0;
		border: 10upx solid transparent;
		border-top-color: #55A0FF;
		margin-top: 0upx;
		margin-left: 5%;
		transform: rotate(180deg);
		
	}
	.order-line{
		width: 120upx;
		height: 3upx;
		margin-top:8upx;
		background: #FFFFFF;
		margin-left: auto;
		margin-right: auto;
		
	}
	.active{
		background: -webkit-linear-gradient(left, #8EC6FF,#6592F7);
		/* Safari 5.1 - 6.0 */
		background: -o-linear-gradient(right, #8EC6FF,#6592F7);
		/* Opera 11.1 - 12.0 */
		background: -moz-linear-gradient(right, #8EC6FF,#6592F7);
		/* Firefox 3.6 - 15 */
		background: linear-gradient(to right, #8EC6FF,#6592F7);
		/* 标准的语法 */
	}
	.like{
		width: 700upx ;
		display: table;
		height: auto;
		padding: 40upx 25upx;
		background: #FFFFFF;
	}
	.like-head{
		width: 700upx;
		margin-bottom: 20upx;
		height: 40upx;
		display: flex;
		flex-direction: row;
		justify-content: center;
	}
	.like-head image{
		width: 81upx;
		height: 15upx;
		margin: 13upx 48upx;
	}
	.like-head text{
		font-size: 28upx;
		line-height: 40upx;
	}
	.goods-item{
		width: 338upx;
		height: 515upx;
		margin-top: 24upx;
		position: relative;
		border-radius: 15upx;
		background: #FFFFFF;
	}
	.goods-item:nth-child(even){
		float: left;
	}
	.goods-item:nth-child(odd){
		float: right;
	}
	.goods-item .item-img{
		width: 338upx;
		height: 336upx;
		border-radius: 15upx 15upx 0 0;
	}
	.goods-item .title{
		padding-left: 24upx;
		padding-right: 24upx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		font-family: PingFang SC Regular;
		font-size: 26upx;
		font-weight: bold;
	}
	.prize{
		height: 30upx;
		color: #55A0FF;
		float: left;
		font-size: 30upx;
		margin-top: 40upx;
		margin-left: 24upx;
		text-align: left;
	}
	.p-dot{
		font-size: 24upx;
	}
	.buyNum{
		width: 200upx;
		float: right;
		text-align: right;
		font-size: 25upx;
		color: #999999;
		margin-right: 24upx;
		margin-top: 46upx;
	}
	.other-btn{
		width: 49upx;
		height: 29upx;
		background: rgba(0,0,0,0.5);
		z-index: 10;
		right: 9upx;
		top:9upx;
		border-radius: 15upx;
		display: flex;
		flex-direction: row;
		position: absolute;
		justify-content: center;
	}
	.other-btn-dot{
		width: 6upx;
		height: 6upx;
		margin-left: 2upx;
		margin-right: 2upx;
		margin-top: 11upx;
		background: #FFFFFF;
		border-radius: 50%;
	}
	.item-btns{
		position: absolute;
		width: 338upx;
		height: 455upx;
		padding-top: 60upx;
		border-radius: 15upx;
		z-index: 8;
		background: rgba(0,0,0,0.5);
	}
	.item-btns image{
		width: 36upx;
		height: 36upx;
		margin-top: 10upx;
		margin-right: 10upx;
	}
	.item-btn{
		width: 260upx;
		height: 60upx;
		background: #FFFFFF;
		border-radius: 50upx;
		margin-left: auto;
		margin-right: auto;
		margin-top: 30upx;
		display: flex;
		flex-direction: row;
		justify-content: center;
	}
	.item-btn text{
		font-size: 26upx;
		color: #333333;
		line-height: 60upx;
	}
</style>
